const express = require('express');
const router = express.Router();
const { categories, products, promotions, orders, logistics } = require('@/controllers/admin/product');

// 分类管理
router.get('/categories', categories.getCategories);
router.post('/categories', categories.createCategory);
router.put('/categories/:id', categories.updateCategory);
router.delete('/categories/:id', categories.deleteCategory);
router.patch('/categories/order', categories.updateOrder);

// 商品管理
router.get('/products', products.getProducts);
router.post('/products', products.createProduct);
router.put('/products/:id', products.updateProduct);
router.delete('/products/:id', products.deleteProduct);
router.patch('/products/status', products.updateStatus);
router.get('/products/analytics', products.getAnalytics);

// 商品活动管理
router.get('/promotions', promotions.getPromotions);
router.post('/promotions', promotions.createPromotion);
router.put('/promotions/:id', promotions.updatePromotion);
router.patch('/promotions/status', promotions.updateStatus);
router.get('/promotions/participation', promotions.getParticipation);
router.post('/promotions/apply', promotions.applyPromotion);

// 订单管理
router.get('/orders', orders.getOrders);
router.get('/orders/:id', orders.getOrderById);
router.put('/orders/:id/status', orders.updateStatus);
router.post('/orders/refund', orders.refundOrder);
router.get('/orders/export', orders.exportOrders);

// 物流管理
router.get('/logistics', logistics.getLogistics);
router.put('/logistics/:id', logistics.updateLogistics);
router.post('/logistics/tracking', logistics.addTracking);
router.get('/logistics/delayed', logistics.getDelayed);

module.exports = router;